`default_nettype none

module clk_div_m #(
    parameter [31:0] MUL_CP_I = 1,
    parameter [31:0] DIV_CP_I = 3
) (
    input rst_w_ni,
    input clk_w_i,

    output clk_w_o
);
    generate
        if (DIV_CP_I % (MUL_CP_I * 2) == 0) begin : gen_even_div
            clk_even_div_m #(
                .DIV_DIV_2_CP_I(DIV_CP_I / (MUL_CP_I * 2))
            ) clk_even_div_i (
                .rst_w_ni(rst_w_ni),
                .clk_w_i (clk_w_i),
                .clk_w_o (clk_w_o)
            );
        end else begin : gen_normal_div
            clk_freq_m #(
                .MUL_CP_I(MUL_CP_I),
                .DIV_CP_I(DIV_CP_I)
            ) clk_freq_i (
                .rst_w_ni(rst_w_ni),
                .clk_w_i (clk_w_i),
                .clk_w_o (clk_w_o)
            );
        end
    endgenerate
endmodule
